﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PhotoGallery.BLL;
using PhotoGallery.Model;
public partial class admin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user"] == null) Response.Redirect("login.aspx");
        string ServerOS = Environment.OSVersion.ToString();                                 //操作系统：
        string CpuSum = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS");         //CPU个数：
        string CpuType = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER");        //CPU类型：
        string ServerSoft = Request.ServerVariables["SERVER_SOFTWARE"];                     //信息服务软件：
        string MachineName = Server.MachineName;                                            //服务器名
        string ServerName = Request.ServerVariables["SERVER_NAME"];                         //服务器域名
        string ServerPath = Request.ServerVariables["APPL_PHYSICAL_PATH"];                  //虚拟服务绝对路径
        string ServerNet = ".NET CLR " + Environment.Version.ToString();                    //DotNET 版本
        string ServerArea = (DateTime.Now - DateTime.UtcNow).TotalHours > 0 ? "+" + (DateTime.Now - DateTime.UtcNow).TotalHours.ToString() : (DateTime.Now - DateTime.UtcNow).TotalHours.ToString();    //服务器时区
        string ServerTimeOut = Server.ScriptTimeout.ToString() + "毫秒";                             //脚本超时时间
        string ServerStart = ((Double)System.Environment.TickCount / 3600000).ToString("N2");   //开机运行时长

        string ServerSessions = Session.Contents.Count.ToString();                          //Session总数
        string ServerApp = Application.Contents.Count.ToString();                           //Application总数
        string ServerCache = Cache.Count.ToString();                                        //应用程序缓存总数

        TableCell1.Text = ServerOS;
        TableCell2.Text = CpuSum;
        TableCell3.Text = CpuType;
        TableCell4.Text = ServerSoft;
        TableCell5.Text = MachineName;
        TableCell6.Text = ServerName;
        TableCell7.Text = ServerPath;
        TableCell8.Text = ServerNet;
        TableCell9.Text = ServerArea;
        TableCell10.Text = ServerTimeOut;
        TableCell11.Text = ServerStart;
        TableCell12.Text = ServerSessions;
        TableCell13.Text = ServerApp;
        TableCell14.Text = ServerCache;


    }
}